#if( USE_GODRAYS == 1)
	float2 ScreenLightPos = float2(0.5, 0.5);
	float2 texCoord = IN.txcoord.xy;
	float2 deltaTexCoord = (texCoord.xy - ScreenLightPos.xy);
	deltaTexCoord *= 1.0 / (float)GodraySamples * GodrayDensity;


	float illuminationDecay = 1.0;

	for(int x = 0; x < GodraySamples; x++) {
	
		texCoord -= deltaTexCoord;;
		float4 sample2 = tex2D(SamplerColor, texCoord.xy);
		float sampledepth = tex2D(SamplerDepth, texCoord.xy).x;
		sample2.w = saturate(dot(sample2.xyz, 0.3333) - GodrayThreshold);
		sample2.r *= 1.0;
		sample2.g *= 0.95;
		sample2.b *= 0.85;
		sample2 *= illuminationDecay * GodrayWeight;
		#if (GODRAYDEPTHCHECK == 1)
		if(sampledepth>0.97) color.xyz += sample2.xyz*sample2.w;
		#else
		color += sample2;
		#endif
		illuminationDecay *= GodrayDecay;
	}
	#endif

